package com.mark.migration.job;

import com.mark.common.quartz.AbstractJob;
import com.mark.migration.service.ArticleQuantityService;
import lombok.extern.log4j.Log4j2;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description :  java类作用描述
 * @Author :  Markburt
 * @CreateDate :  2020/3/4$ 下午 09:42$
 * @UpdateUser :  Markburt
 * @UpdateDate :  2020/3/4$ 下午 09:42$
 * @UpdateRemark :  Project Build
 * @Version :  1.0
 */

@Component
@DisallowConcurrentExecution
@Log4j2
@SuppressWarnings("all")
public class MigrationDbToHBaseQuartz extends AbstractJob {
    @Autowired
    private ArticleQuantityService articleQuantityService;


    @Override
    public String[] triggerCron() {
        return new String[]{"0 0/2 * * * ?"};
    }

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        log.info("开始同步文章数据到hbase");
        articleQuantityService.dbToHbase();
        log.info("同步文章数据到hbase完成");
    }
}
